﻿@using Microsoft.AspNetCore.Hosting
@using Microsoft.Extensions.Hosting
@model LayoutEntity
@{
    if (Model == null)
    {
        return;
    }
    Style.Reqiured("Easy").AtFoot();
    CMSApplicationContext appContext = ApplicationContext as CMSApplicationContext;
    foreach (var item in appContext.Styles)
    {
        Style.Reqiured(item).AtFoot();
    }
    foreach (var item in appContext.Scripts)
    {
        Script.Reqiured(item).AtFoot();
    }
}
<!-- http://www.zkea.net/ Copyright 2017 ZKEASOFT http://www.zkea.net/licenses -->
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="zh"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="zh"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="zh"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html class="not-ie" lang="zh">
<!--<![endif]-->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>@Model.Page.Title</title>
    <meta name="keywords" content="@Model.Page.MetaKeyWorlds" />
    <meta name="description" content="@Model.Page.MetaDescription" />
    <meta name="author" content="ZKEASOFT" />
    <meta name="about" content="@ZKEACMS.Version.CurrentVersion" />
    <meta name="website" content="http://www.zkea.net" />
    @if (ApplicationContext.As<CMSApplicationContext>().OuterChainPicture)
    {
        <meta name="referrer" content="same-origin" />
    }
    @if (ApplicationContext.As<CMSApplicationContext>().EnableResponsiveDesign)
    {
        <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,maximum-scale=1.0" />
    }
    <link href="@Url.PathContent(Model.Page.Favicon)" rel="shortcut icon" type="image/x-icon" />
    @StyleAtHead()
    @ScriptAtHead()
    @foreach (var item in appContext.HeaderPart)
    {
        @item
    }
    @if (Model.CurrentTheme != null)
    {
        if (ApplicationContext.HostingEnvironment.IsDevelopment())
        {
            <link type="text/css" async rel="stylesheet" href="@Url.Content(Model.CurrentTheme.UrlDebugger)" />
        }
        else
        {
            <link type="text/css" async rel="stylesheet" href="@Url.Content(Model.CurrentTheme.Url)" />
        }
    }
</head>
<body class="front">
    @if (Authorizer.Authorize(PermissionKeys.ManagePage) && (ApplicationContext as CMSApplicationContext).PageMode != ZKEACMS.Filter.PageViewMode.ViewOnly)
    {
        <div class="preview-toolbar hover-text hidden-xs" style="position:fixed; z-index:10000;left:5px;top:5px;">
            <div class="zk-btn-group">
                <a class="zk-btn zk-btn-primary sort-handle">
                    <i class="glyphicon glyphicon-move"></i>
                </a>
                @if (!Model.Page.IsPublishedPage)
                {
                    <a class="zk-btn zk-btn-primary" href="@Url.Action("Design", "Page", new { Model.Page.ID })">
                        <i class="glyphicon glyphicon-pencil"></i>
                        @L("编辑")
                    </a>
                    @if (Model.Page.PublishDate.HasValue)
                    {
                        <a class="zk-btn zk-btn-primary" href="@Url.Content(Model.Page.Url)">
                            <i class="glyphicon glyphicon-eye-open"></i>
                            @L("预览发布版本")
                        </a>
                    }
                    <a class="zk-btn zk-btn-primary" href="@Url.Action("Index", "Page",new { PageId=Model.Page.ID })">
                        <i class="glyphicon glyphicon-th-list"></i>
                        @L("页面概览")
                    </a>
                    <a class="zk-btn zk-btn-primary" href="@Url.Action("PublishPage", "Page", new { Model.Page.ID, ReturnUrl = Model.Page.Url})">
                        <i class="glyphicon glyphicon-open"></i>
                        @L("发布")
                    </a>
                    if (Model.CurrentTheme != null && Model.CurrentTheme.IsPreView)
                    {
                        <a class="zk-btn zk-btn-primary" href="@Url.Action("CancelPreView", "Theme")">
                            <i class="glyphicon glyphicon-transfer"></i>
                            @L("退出")
                            @Model.CurrentTheme.Title
                            @L("主题")
                        </a>
                    }
                }
                else if (Model.PreViewPage != null)
                {
                    <a class="zk-btn zk-btn-primary" href="@Url.Action("Design", "Page", new { Model.PreViewPage.ID})">
                        <i class="glyphicon glyphicon-pencil"></i>
                        @L("编辑")
                    </a>
                    <a class="zk-btn zk-btn-primary" href="@Url.Action("RedirectView", "Page", new { ID = Model.PreViewPage.ID})">
                        <i class="glyphicon glyphicon-eye-open"></i>
                        @L("预览编辑版本")
                    </a>
                    if (Model.CurrentTheme != null && Model.CurrentTheme.IsPreView)
                    {
                        <a class="zk-btn zk-btn-primary" href="@Url.Action("CancelPreView", "Theme")">
                            <i class="glyphicon glyphicon-transfer"></i>
                            @L("退出")
                            @Model.CurrentTheme.Title
                            @L("主题")
                        </a>
                    }
                    <a class="zk-btn zk-btn-primary" href="@Url.Action("Index", "Page",new { PageId = Model.PreViewPage.ID })">
                        <i class="glyphicon glyphicon-th-list"></i>
                        @L("页面概览")
                    </a>
                    <a class="zk-btn zk-btn-primary" href="@Url.Action("Logout", "Account", new { returnurl = ViewContext.HttpContext.Request.Path.Value })">
                        <i class="glyphicon glyphicon-off"></i>
                        @L("退出")
                    </a>
                }
            </div>
        </div>
        using (Script.AtFoot())
        {
            <script type="text/javascript">
                var toolBar = $(".preview-toolbar");
                $(".sort-handle", toolBar).DragElement(toolBar);
            </script>
        }
    }

    <div>
        @RenderBody()
    </div>

    @StyleAtFoot()
    @ScriptAtFoot()
    @if (!Model.Style.IsNullOrEmpty())
    {
        <link href="@Url.Content(Model.Style)" rel="stylesheet" />
    }
    @foreach (var style in Model.Page.Styles)
    {
        <link href="@Url.Content(style.Url)" rel="stylesheet" />
    }
    @if (!Model.Script.IsNullOrEmpty())
    {
        <script type="text/javascript" src="@Url.Content(Model.Script)"></script>
    }
    @foreach (var script in Model.Page.Scripts)
    {
        <script type="text/javascript" src="@Url.Content(script.Url)"></script>
    }
    @foreach (var item in appContext.FooterPart)
    {
        @item
    }
</body>

</html>